import Vue from 'vue'
import VueRouter from 'vue-router'
import BpHistoricalData from '../views/BpHistoricalData'
import BgHistoricalData from '../views/BgHistoricalData'

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/bpHistoricalData', meta: { title: '血压历史数据' } },
  {
    path: '/bpHistoricalData',
    name: 'BpHistoricalData',
    meta: { title: '血压历史数据' },
    component: BpHistoricalData,
  },
  {
    path: '/bgHistoricalData',
    name: 'BgHistoricalData',
    meta: { title: '血糖历史数据' },
    component: BgHistoricalData,
  },
]

const router = new VueRouter({
  routes,
})

router.afterEach(to => {
  document.title = to.meta.title || '血压历史数据'
})

export default router
